package com.lxmes.procontrol.service.impl;

import java.util.List;

import com.lxmes.common.annotation.DataScope;
import com.lxmes.common.utils.DateUtils;
import com.lxmes.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.lxmes.procontrol.mapper.NcProOrderInfoBgMapper;
import com.lxmes.procontrol.domain.NcProOrderInfoBg;
import com.lxmes.procontrol.service.INcProOrderInfoBgService;

/**
 * 产线工位报工单Service业务层处理
 *
 * @author 张志煜
 * @date 2022-12-30
 */
@Service
public class NcProOrderInfoBgServiceImpl implements INcProOrderInfoBgService
{
    @Autowired
    private NcProOrderInfoBgMapper ncProOrderInfoBgMapper;

    /**
     * 查询产线工位报工单
     *
     * @param id 产线工位报工单主键
     * @return 产线工位报工单
     */
    @Override
    public NcProOrderInfoBg selectNcProOrderInfoBgById(Long id)
    {
        return ncProOrderInfoBgMapper.selectNcProOrderInfoBgById(id);
    }

    /**
     * 查询产线工位报工单列表
     *
     * @param ncProOrderInfoBg 产线工位报工单
     * @return 产线工位报工单
     */
    @Override
    @DataScope(deptAlias = "du", userAlias = "du")
    public List<NcProOrderInfoBg> selectNcProOrderInfoBgList(NcProOrderInfoBg ncProOrderInfoBg)
    {
        return ncProOrderInfoBgMapper.selectNcProOrderInfoBgList(ncProOrderInfoBg);
    }

    /**
     * 新增产线工位报工单
     *
     * @param ncProOrderInfoBg 产线工位报工单
     * @return 结果
     */
    @Override
    public int insertNcProOrderInfoBg(NcProOrderInfoBg ncProOrderInfoBg)
    {
        ncProOrderInfoBg.setCreateTime(DateUtils.getNowDate());
        ncProOrderInfoBg.setCreateBy(SecurityUtils.getUsername());
        return ncProOrderInfoBgMapper.insertNcProOrderInfoBg(ncProOrderInfoBg);
    }

    /**
     * 修改产线工位报工单
     *
     * @param ncProOrderInfoBg 产线工位报工单
     * @return 结果
     */
    @Override
    public int updateNcProOrderInfoBg(NcProOrderInfoBg ncProOrderInfoBg)
    {
        ncProOrderInfoBg.setUpdateTime(DateUtils.getNowDate());
        ncProOrderInfoBg.setUpdateBy(SecurityUtils.getUsername());
        return ncProOrderInfoBgMapper.updateNcProOrderInfoBg(ncProOrderInfoBg);
    }

    /**
     * 批量删除产线工位报工单
     *
     * @param ids 需要删除的产线工位报工单主键
     * @return 结果
     */
    @Override
    public int deleteNcProOrderInfoBgByIds(Long[] ids)
    {
        return ncProOrderInfoBgMapper.deleteNcProOrderInfoBgByIds(ids);
    }

    /**
     * 删除产线工位报工单信息
     *
     * @param id 产线工位报工单主键
     * @return 结果
     */
    @Override
    public int deleteNcProOrderInfoBgById(Long id)
    {
        return ncProOrderInfoBgMapper.deleteNcProOrderInfoBgById(id);
    }





}
